//
// Created by czm on 2023/12/13.
//

#ifndef DDWK_RFID_SCAN_GLOBAL_H
#define DDWK_RFID_SCAN_GLOBAL_H

#include "nimble/ble.h"

#define PORT0_NUM UART_NUM_0
#define PORT0_TX_PIN (GPIO_NUM_44)
#define PORT0_RX_PIN (GPIO_NUM_43)

#define PORT1_NUM UART_NUM_1
#define PORT1_TX_PIN (GPIO_NUM_18)
#define PORT1_RX_PIN (GPIO_NUM_17)

#define PORT2_NUM UART_NUM_2
#define PORT2_TX_PIN (GPIO_NUM_37)
#define PORT2_RX_PIN (GPIO_NUM_38)

//RGB LED配置
#define LED_TYPE LED_STRIP_WS2812   /// LED驱动芯片类型
#define LED_NUM 1                   /// 驱动芯片数量
#define LED_DATA_GPIO GPIO_NUM_48   /// LED数据GPIO引脚

#define LED_POWER   GPIO_NUM_38
#define LED_RUNNING GPIO_NUM_37

#define RFID_PORT_NUM PORT1_NUM
#define RFID_PORT_TX  PORT1_TX_PIN
#define RFID_PORT_RX  PORT1_RX_PIN

#define RFID_ANT_COUNT 4
#define RFID_SEND_CMD_DELAY (400*1000)  ///RFID命令发送间隔

#define GATT_DEVICE_INFO_UUID                   0x180A
#define GATT_MANUFACTURER_NAME_UUID             0x2A29
#define GATT_MODEL_NUMBER_UUID                  0x2A24

#define GATT_RFID_UUID                   0xFFF0
#define GATT_RFID_CARD_REPORT_UUID                0xFFF2
#define GATT_RFID_CONTROLLER_UUID                0xFFF1

extern volatile bool g_notify_flag;                    /// RFID订阅标志
extern uint16_t g_card_notify_handle;         /// RFID订阅句柄
extern uint16_t g_conn_handle;

extern uint8_t g_last_card[32];
extern uint8_t g_last_card_len;

extern char g_device_name[32];

#endif //DDWK_RFID_SCAN_GLOBAL_H
